#pragma once
#include "gtl/list.h"
#include "util/smartptr.h"
#include "iserialisable.h"
#include <set>

namespace gecko
{

	//---------------------------------------------------------------------------------------------

	class IStream;
	typedef gtl::List< StrongPtr<ISerialisable> > SerialisableList;
	typedef std::set<MetaClass*> MetaClassSet;

	//---------------------------------------------------------------------------------------------

	// class used to serialise a list of object to and from a stream
	class Serialiser
	{
	public:
		// error codes
		enum Error
		{
			Error_Success,
			Error_InvalidObject
		};

		// constructor
		Serialiser();

		// destructor
		~Serialiser();

		// serialise the objects
		Error SerialiseObjects(IStream& stream, SerialisableList& objectList);
	
	private:
		// search the meta classes for the named class
		MetaClass* FindMetaClass(MetaClassSet& metaClasses, char* className);
	};

	//---------------------------------------------------------------------------------------------

}